<html xmlns="http://www.w3.org/1999/xhtml" >
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
    <link rel="stylesheet" type="text/css" href="/css/style_member.css" />
    <link rel="stylesheet" type="text/css" href="/css/reset.css" />
     <link rel="stylesheet" type="text/css" href="/css/nivo-slider.css" />
    <link rel="stylesheet" type="text/css" href="/css/style_index.css" />
    <script type="text/javascript" src="/third/My97DatePicker/WdatePicker.js"></script>
<body>
            <table cellpadding="0" cellspacing="0" class="member_table">
                <tr>
                    <td class="td_2" valign="top">
                        <div>
                            <table cellpadding="10" cellspacing="1" class="member_table2" style="text-align:left;">
                                <tr class="td2">
                                    <td style="width:200px;"><b>定制编号：</b></td>
                                    <td style="width:240px;">Dz${artMade.identifier}</td>
                                    <td style="width:120px;"><b>定制时间：</b></td>
                                    <td><fmt:formatDate value="${artMade.gmtCreated}" pattern="yyyy-MM-dd HH:mm:SS" /></td>
                                </tr>
                                <tr class="td1">
                                    <td style="width:200px;"><b>定制者：</b></td>
                                    <td style="width:240px;">${artMade.madeName}</td>
                                    <td style="width:120px;"><b>艺术家：</b></td>
                                    <td>${artMade.artist.name}</td>
                                </tr>
                                <tr class="td2">
                                    <td colspan="4" style="height:40px;"><b>填写定制价格与周期</b></td>
                                </tr>
                                <tr class="td2">
                                    <td colspan="4"><b <c:if test="${artMade.stage eq '01'}">style="color: red;"</c:if>>预付款：</b>
                                   		 <input type="text" class="input4" name="firstMoney" id="firstMoney"  <c:if test="${artMade.stage eq '02' || artMade.stage eq '03'}">disabled="disabled"</c:if> value="${firstMoney }"/>
                                
                                    <b <c:if test="${artMade.stage eq '02'}">style="color: red;"</c:if>>中间款：</b>
                                   			<input type="text" class="input4" name="secondMoney" id="secondMoney" <c:if test="${artMade.stage eq '03'}">disabled="disabled"</c:if> value="${secondMoney }" onblur="setCount(this,'${secondMoney }','${totalMoney }')"/>
                                    
                              <b <c:if test="${artMade.stage eq '03'}">  style="color: red;"</c:if>>尾款：</b>
                                  		<input type="text" class="input4" name="thirdMoney" id="thirdMoney" value="${thirdMoney }" <c:if test="${artMade.stage eq '02' }">disabled="disabled"</c:if> onblur="setCountThird(this,'${thirdMoney }','${totalMoney }')"/>
                                  
                                    
                                 		　<b>总价：</b> <input type="text" class="input4" name="totalMoney" id="totalMoney" <c:if test="${artMade.stage eq '02' || artMade.stage eq '03'}">disabled="disabled"</c:if> value="${totalMoney }"/> 
                                     </td>
                                </tr>
                                <tr class="td2">
                                    <td colspan="4"><b>定制周期：</b><fmt:formatDate value="${startDate}" pattern="yyyy-MM-dd " />-- <fmt:formatDate value="${endDate}" pattern="yyyy-MM-dd " />
                                      <c:if test="${artMade.stage eq '01'}">  <span>
                                      <input class="tb_date" type="text" id="startDate" readonly="readonly" name="startDate" onclick="WdatePicker({el:'startDate',dateFmt:'yyyy-MM-dd',readOnly:true,isShowClear:false});" />
                                      <input class="tb_date" type="text" id="endDate" readonly="readonly" name="endDate" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd',readOnly:true,isShowClear:false});" />
                                      </span></c:if>
                                    <c:if test="${artMade.stage eq '02'}">  <span></span></c:if>
                                     <c:if test="${artMade.stage eq '03'}">  <span></span></c:if>
                                    </td>
                                </tr>
                                <tr class="td2">
                                    <td colspan="4"><b>留言：</b><textarea id="remark" cols="20" rows="2" class="input3"></textarea></td>
                                </tr>
                                <tr class="td2">
                                    <td colspan="4" style=" height:50px; text-align:right;">
                                        <span><input type="button"  value="提交" onclick="svaeAudit();" style="width: 100px" id="svaeAudit"/></span>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
            <script type="text/javascript">
            
            	function setCount(text,second,total){ 
            	   var secondMoneyNew = text.value;   
            	   //alert(second);
            	  var poor=	parseInt(secondMoneyNew)-parseInt(second);
            	  var endTotal=parseInt(total)+parseInt(poor);
            	  $("#totalMoney").val(endTotal);
            	  } 
            	function setCountThird(text,third,total){ 
             	   var thirdMoneyNew = text.value;   
             	   //alert(second);
             	  var poor=	parseInt(thirdMoneyNew)-parseInt(third);
             	  var endTotal=parseInt(total)+parseInt(poor);
             	  $("#totalMoney").val(endTotal);
             	  } 
            function svaeAudit(){
            	
					var content =$("#content").val();
					$.post("/misc/made/saveMadeAudit.htm", {
						firstMoney : $("#firstMoney").val(),
						secondMoney : $("#secondMoney").val(),
						thirdMoney : $("#thirdMoney").val(),
						totalMoney : $("#totalMoney").val(),
						startDate : $("#startDate").val(),
						endDate : $("#endDate").val(),
						madeId : ${madeId},
						remark:$("#remark").val()
					},function(data){
						if(data=="success"){
							alert("提交成功");
							$("#svaeAudit").attr("disabled", true);
						}
						if(data=="error"){
							alert("提交出错了。");
						}
					});
			}
            </script>
</body>
</html>
